home *** CD-ROM | disk | FTP | other *** search
- /*
- +--------------------------------------------------------+
- | display port output port |
- | +-----------------------+ +--------------------------+ |
- | | A B C D E F G H RS TW | | A B C D E F G H RS TW DT | |
- | +-----------------------+ +--------------------------+ |
- | 1 *********************** 9 *********************** |
- | 2 *********************** 10 *********************** |
- | 3 *********************** 11 *********************** |
- | 4 *********************** 12 *********************** |
- | 5 *********************** 13 *********************** |
- | 6 *********************** 14 *********************** |
- | 7 *********************** 15 *********************** |
- | 8 *********************** 16 *********************** |
- | [PLAY] [STOP] [ END ] |
- +--------------------------------------------------------+
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include "graphic.h"
- #include "coldef.h"
-
- #define EUP_X1 (23*8)
- #define EUP_Y1 180
- #define EUP_X2 (57*8-4)
- #define EUP_Y2 260
-
- #define EUP_BAR_SIZE 64
- #define EUP_BAR_X1 (EUP_X1+8)
- #define EUP_BAR_Y1 (EUP_Y1+8)
- #define EUP_BAR_X2 (EUP_X1+11)
- #define EUP_BAR_Y2 (EUP_BAR_Y1+EUP_BAR_SIZE)
-
- #define TRK_MAX 32
-
- static BLOCK *save = NULL;
- static char *old_ptr = NULL;
- static int old_tick = 0;
- static int note_max[TRK_MAX];
- static int note_vol[TRK_MAX];
-
- void EUP_open()
- {
- int n;
-
- MOS_disp(OFF);
- save = DSP_push_vram(EUP_X1,EUP_Y1,EUP_X2,EUP_Y2);
- DSP_opbox(EUP_X1,EUP_Y1,EUP_X2,EUP_Y2);
- DSP_wbox(EUP_X1,EUP_Y1,EUP_X2,EUP_Y2,LINE_COL,FILD_COL,M_PSET);
-
- for ( n = 0 ; n < TRK_MAX ; n++ ) {
- note_vol[n] = note_max[n] = (-1);
- DSP_box( EUP_BAR_X1+n*8-1, EUP_BAR_Y1-1,
- EUP_BAR_X2+n*8+1, EUP_BAR_Y2+1,
- 7, M_PSET);
- }
- old_tick = tick_timer = 0;
- old_ptr = NULL;
- }
- void EUP_close()
- {
- DSP_pop_vram(save);
- DSP_clbox(EUP_X1,EUP_Y1,EUP_X2,EUP_Y2);
- MOS_disp(ON);
- }
- void EUP_note_on(int trk, int vol)
- {
- int n;
- int x1, x2;
-
- vol = ((vol * EUP_BAR_SIZE) / 127) & 0xFFFE;
-
- x1 = EUP_BAR_X1 + trk * 8;
- x2 = EUP_BAR_X2 + trk * 8;
-
- if ( note_vol[trk] >= 0 && note_max[trk] > vol )
- DSP_box(x1, EUP_BAR_Y2 - note_max[trk],
- x2, EUP_BAR_Y2 - vol,
- 7, M_PSET);
-
- DSP_line(x1, EUP_BAR_Y2 - vol,
- x2, EUP_BAR_Y2 - vol,
- 2, M_PSET);
-
- for ( n = vol - 2 ; n >= 0 && n >= note_vol[trk] ; n -= 2 ) {
- DSP_line(x1, EUP_BAR_Y2 - n,
- x2, EUP_BAR_Y2 - n,
- 10, M_PSET);
- }
-
- note_vol[trk] = note_max[trk] = vol;
- }
- void EUP_chk(char *ptr)
- {
- int n;
-
- if ( old_tick < tick_timer ) {
- for ( n = 0 ; n < TRK_MAX ; n++ ) {
- if ( note_vol[n] >= 2 ) {
- note_vol[n] -= 2;
- DSP_line(EUP_BAR_X1 + n * 8,
- EUP_BAR_Y2 - note_vol[n],
- EUP_BAR_X2 + n * 8,
- EUP_BAR_Y2 - note_vol[n],
- 7, M_PSET);
- } else if ( note_vol[n] == 0 ) {
- DSP_line(EUP_BAR_X1 + n * 8,
- EUP_BAR_Y2 - note_max[n],
- EUP_BAR_X2 + n * 8,
- EUP_BAR_Y2 - note_max[n],
- 7, M_PSET);
- note_vol[n] = (-1);
- }
- }
- old_tick += 16;
- }
-
- if ( ptr == NULL )
- return;
-
- if ( old_ptr == NULL )
- old_ptr = ptr;
-
- while ( old_ptr < ptr ) {
- if ( (*old_ptr & 0xF0) == 0x90 )
- EUP_note_on(old_ptr[4] / 4, old_ptr[5] & 127);
- /******************
- EUP_note_on(old_ptr[1] % TRK_MAX, old_ptr[5] & 127);
- *******************/
- old_ptr += 6;
- }
- }